import request from "./request";

// 按关键字搜索用户列表
export function getUserList(keyword, pageNum) {
    return request({
        url: '/admin/userManage/getUserList',
        method: 'post',
        data: {
            keyword,
            pageNum
        }
    })
}

// 拉黑单个用户
export function toBlackListUser(id) {
    return request({
        url: '/admin/userManage/blackListUser',
        method: 'post',
        data: {
            id
        }
    })
}
// 拉黑用户列表
export function toBlackListUsers(idList) {
    return request({
        url: '/admin/userManage/blackListUsers',
        method: 'post',
        data: {
            idList
        }
    })
}


// 返回黑名单数据
export function blackListData() {
    return request({
        url: '/admin/userManage/blackList',
        method: 'get',
    })
}

// 返回黑名单的搜索数据
export function getBlackListUsers(keyword, pageNum) {
    return request({
        url: '/admin/userManage/getBlackList',
        method: 'post',
        data: {
            keyword,
            pageNum
        }
    })
}

// 将用户移出黑名单
export function cancelBlackListUser(id) {
    return request({
        url: '/admin/userManage/cancelBlackListUser',
        method: 'post',
        data: {
            id
        }
    })
}

// 批量移出黑名单
export function cancelBlackListUsers(idList) {
    return request({
        url: '/admin/userManage/cancelBlackListUsers',
        method: 'post',
        data: {
            idList
        }
    })
}

// 添加管理员接口
export function addAdmin(id) {
    return request({
        url: "/admin/userManage/addAdministrator",
        method: 'post',
        data: {
            id
        }
    })
}

// 批量添加为管理员
export function addAdmins(idList) {
    return request({
        url: "/admin/userManage/addAdministrators",
        method: "post",
        data: {
            idList
        }
    })
}

// 按名称关键字搜索管理员
export function searchAdmins(keyword, pageNum) {
    return request({
        url: "/admin/userManage/getAdministratorList",
        method: "post",
        data: {
            keyword,
            pageNum
        }
    })
}

// 将对应id的用户移出管理员列表
export function cancelAdminListUser(id) {
    return request({
        url: "/admin/userManage/cancelAdminListUser",
        method: "post",
        data: {
            id,
        }
    })
}

// 批量将管理员移入管理员列表
export function cancelAdminListUsers(idList) {
    return request({
        url: "/admin/userManage/cancelAdminListUsers",
        method: "post",
        data: {
            idList
        }
    })
}